package ace.module.account.core.impl.api.impl;

import ace.cmp.core.model.R;
import ace.module.account.api.IamApplicationApi;
import ace.module.account.api.model.dto.IamApplicationDto;
import ace.module.account.core.impl.dao.entity.IamApplication;
import ace.module.account.core.impl.manager.IamApplicationManager;
import ace.module.common.api.annotation.ApiLocalPriority;
import ace.module.common.core.impl.api.impl.SdkApiImpl;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;


/**
 * 账户应用 api implements.
 *
 * @author Caspar
 *
 */
@ApiLocalPriority
@AllArgsConstructor
@Component
public class IamApplicationApiImpl
    extends SdkApiImpl<IamApplication, Long, IamApplicationDto, IamApplicationManager>
    implements IamApplicationApi {

  private final IamApplicationManager iamApplicationManager;

  @Override
  public R<IamApplicationDto> getByOutTypeAndOutId(String outType, String outId) {
    IamApplicationDto iamApplicationDto = iamApplicationManager.getDtoByOutTypeAndOutId(outType, outId);
    return R.ok(iamApplicationDto);
  }

  @Override
  public R<IamApplicationDto> getAndCheckByOutTypeAndOutId(String outType, String outId) {
    IamApplicationDto iamApplicationDto = iamApplicationManager.getAndCheckDtoByOutTypeAndOutId(outType, outId);
    return R.ok(iamApplicationDto);
  }
}
